package fr.vahren.dotastrat.game;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import fr.vahren.dotastrat.game.command.D2SCommand;

public class D2SActionStack {

	private Map<Integer, List<D2SCommand>> actionStack = new HashMap<>();

	public D2SActionStack() {
		// put priorities
		actionStack.put(0, new ArrayList<D2SCommand>());
		actionStack.put(1, new ArrayList<D2SCommand>());
		actionStack.put(2, new ArrayList<D2SCommand>());
		actionStack.put(3, new ArrayList<D2SCommand>());
		actionStack.put(4, new ArrayList<D2SCommand>());
	}

	public void add(D2SCommand c) {
		actionStack.get(c.getPriority()).add(c);
	}

	public List<D2SCommand> getActions(int priority) {
		return actionStack.get(priority);
	}

	public void clear(int i) {
		actionStack.get(i).clear();
	}
}
